package com.srlg.batch.model.entity;


import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.jdbc.core.RowMapper;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * 作者
 */
//@Entity(name = "t_author")
@Data
public class Author implements RowMapper<Author> {

    @Id
    private Long id;

    private String name;

    @Override
    public Author mapRow(ResultSet rs, int rowNum) throws SQLException {

        long id = rs.getLong(0);
        String name = rs.getString(this.name);

        Author author = new Author();
        author.setId(id);
        author.setName(name);

        return author;
    }
}
